package com.msmap.apphome;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.widget.Toast;

/**
 * //必须动态注册，不能写在清单文件中
 * Created by Administrator on 2016/10/22.
 */

public class ScreenReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();
        if (Intent.ACTION_SCREEN_OFF.equals(action)){
            Toast.makeText(context, "屏幕休眠", Toast.LENGTH_SHORT).show();
            Log.i("aaa", "onReceive:屏幕休眠 ");
        }else{
            Toast.makeText(context, "屏幕唤醒", Toast.LENGTH_SHORT).show();
            Log.i("aaa", "onReceive: 屏幕唤醒");

        }
    }
}
